<extend name="common:base" />
<block name="content">
		<div id="header">
	        <div class="header">
	            <h1 class="tit">修改密码</h1>
	            <!--<p class="goback">-->
	                <!--<a class="return" href="javascript:history.go(-1);">返回</a>-->
	            <!--</p>-->
	            <!--<p class="more"><a class="share" href=""></a></p>-->
	        </div>
	    </div>
	    <form>
	    <div class="xgmm-a">
	    	<div class="xgmm-aa">
	    		<div class="xgmm-a1">
	    			<span>旧密码</span>
	    			<input type="password" name="old_pwd" placeholder="请输入旧密码" id="old_pwd"/>
	    		</div>
	    		<div class="xgmm-a1">
	    			<span>新密码</span>
	    			<input type="password" name="new_pwd" placeholder="6-16位字符" id="new_pwd"/>
	    		</div>
	    		<div class="xgmm-a1">
	    			<span>确认密码</span>
	    			<input type="password" name="confirm_new_pwd" placeholder="6-16位字符" id="confirm_new_pwd"/>
	    		</div>
	    	</div>
	    </div>
	    <input type="button" value="提交" class="xgmm-btn" id="save"/>
	    </form>
</block>
<block name="CSS">
    <link rel="stylesheet" href="{:C('__STATIC__')}{$theme}/Static/{:C('css')}/total.css" />
</block>
<block name="JS">
    <script type="text/javascript">
        $('#save').click(function(e) {
            var old_pwd = $('#old_pwd').val();
            var new_pwd = $('#new_pwd').val();
            var confirm_new_pwd = $('#confirm_new_pwd').val();
            if (old_pwd == '') {layer.msg('请填写旧密码!', {icon: 2,time:1000});return false;}
            if (new_pwd == '') {layer.msg('请填写新密码!', {icon: 2,time:1000});return false;}
            if (confirm_new_pwd == '') {layer.msg('请填写确认密码!', {icon: 2,time:1000});return false;}
            if (confirm_new_pwd != new_pwd) {layer.msg('新密码和确认密码不一致!', {icon: 2,time:1000});return false;}
            $.ajax({
                url: "{:U('Setting/edit_pass')}",
                type: 'post',
                data:{
                    'old_pwd':old_pwd,
                    'new_pwd':new_pwd
                },
                success: function(msg) {
                    if (msg == 0) {
                        layer.msg('旧密码填写错误!', {icon: 2,time:1000});
                    } else {
                        layer.msg('修改成功!', {icon: 1,time:1000});
                        setTimeout(function() {
                          window.history.back();
                        }, 500);
                    }
                 }
            });
            e.preventDefault();
        });
    </script>
</block>